package com.sofwin;

import java.io.Serializable;

/**
 * @packageName: com.sofwin
 * @user: andyliu
 * @date: 2023/5/16 15:22
 * @email 115176513@qq.com
 * @description: 用来封装异步请求
 */

public class R implements Serializable {
    private static final long serialVersionUID = -7714968395322464603L;
    private Integer status;// 请求的响应状态
    private String message; // 请求响应的提示信息
    private Object data; // 真实响应的数据
    public R(){

    }
    public R(Integer status,String message,Object data){
        this.status = status;
        this.message = message;
        this.data = data;
    }
    public static R success(){
        return new R(200,"操作成功",null);
    }
    public static R success(String message,Object data){
        return new R(200,message,data);
    }
    public static R success(Object data){
        return new R(200,"操作成功",data);
    }
    public static R error(){
        return new R(600,"操作失败",null);
    }
    public static R error(String message,Object data){
        return new R(600,message,data);
    }
    public static R error(Object data){
        return new R(600,"操作失败",data);
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
